<template>
    <div class="form-select">
        <Select v-model="newValue" @on-change="handlerChange" :multiple="multiple">
            <Option v-for="(option, index) in options" :value="option.value" :key="index">{{option.label}}</Option>
        </Select>
    </div>
</template>
<script>
import { Component, Vue, Model, Watch, Prop } from "vue-property-decorator";
@Component
export default class extends Vue{
    @Prop(Array) options: any
    @Prop(Boolean) multiple: boolean
    @Model('change', { type: [String, Array] }) value!: any
    newValue = "";
    @Watch('value')
    onValueChange(value) {
        this.newValue = value;
    }
    mounted () {
        this.newValue = this.value;
    }
    handlerChange(value) {
        console.log(value);
        this.$emit('change', value);
    }
}
</script>
